package com.eshidai.simple_springboot.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import com.eshidai.simple_springboot.bean.User;
import com.eshidai.simple_springboot.service.HelloService;

@Service
public class HelloServiceImpl implements HelloService {
	
	@Autowired
    private JdbcTemplate jdbcTemplate;
	
	public User getUser() {
		User u = new User();
		u.setId(123456L);
		u.setName("eshidai");
		u.setAge(28);
		return u;
	}
	
	/**
	 * 抛异常不处理
	 */
	public void addUser() throws Exception {
		jdbcTemplate.update("insert into msg_send(?,?) values");
		throw new Exception();
	}
}
